﻿using System;
using MaxStoreErp.Core.BaseClasses;
using MaxStoreErp.Core.Commands;
using MaxStoreShop.Domain.Directories;

namespace MaxStoreShop.CoreModule.ChangePasswordDialog
{
    class ChangePasswordDialogViewModel : ViewModelBase
    {
        public RelayCommand CancelCommand { get; set; }
        public RelayCommand EnterCommand { get; set; }
        public Action OnFieldChanged { get; set; }
        StoreUser _selectedUser;
        string _oldPassword;
        string _newPassword;
        string _reenteredNewPassword;
        string _errorText;

        public StoreUser SelectedUser
        {
            get { return _selectedUser; }
            set { OnPropertyChanged(ref _selectedUser, value, "SelectedUser"); }
        }

        public string OldPassword
        {
            get { return _oldPassword; }
            set { OnPropertyChanged(ref _oldPassword, value, OnFieldChanged, "OldPassword"); }
        }

        public string NewPassword
        {
            get { return _newPassword; }
            set { OnPropertyChanged(ref _newPassword, value, OnFieldChanged, "NewPassword"); }
        }

        public string ReenteredNewPassword
        {
            get { return _reenteredNewPassword; }
            set { OnPropertyChanged(ref _reenteredNewPassword, value, OnFieldChanged, "ReenteredNewPassword"); }
        }

        public string ErrorText
        {
            get { return _errorText; }
            set { OnPropertyChanged(ref _errorText, value, "ErrorText"); }
        }
    }
}
